import { strategicManage } from '~/config/server'
import { NetService } from '~/utils/net.service';
import { Inject, Debounce } from '~/core/decorator';
import { Service } from '~/core/service';

export class DateStrategyService extends Service {
  @Inject(NetService)
  private netService: NetService;

  /**
   * 查询全部日期策略
   */
  @Debounce()
  public getDateStrategy (data, page) {
    return this.netService.send({
      server: strategicManage.dataStrategy.queryAllDateStrategyPage,
      data,
      page,
    });
  }

  /**
   * 查询一条策略日志
   */
  // @Debounce()
  // public findDateStrategyLog (data) {
  //   return this.netService.send({
  //     server: strategicManage.dataStrategy.queryResponseEntityLogList,
  //     data,
  //   });
  // }

  /**
   * 查询某个日期策略已审批通过的日志
   */
   @Debounce()
   public findDateStrategyLog (data) {
     return this.netService.send({
       server: strategicManage.dataStrategy.queryResponseEntityPassLogList,
       data,
     });
   }

  /**
   * 保存日期策略
   */
  @Debounce()
  public saveDateStrategy (data) {
    return this.netService.send({
      server: strategicManage.dataStrategy.saveDateStrategy,
      data,
      loading: true,
    });
  }

  /**
   * 停用实体ID
   */
  @Debounce()
  public stopOrStartDateStrategy (data) {
    return this.netService.send({
      server: strategicManage.dataStrategy.stopOrStartDateStrategy,
      data,
      loading: true,
    });
  }

  /**
   * 修改日期策略
   */
  @Debounce()
  public updateStrategy (data) {
    return this.netService.send({
      server: strategicManage.dataStrategy.updateDateStrategy,
      data,
      loading: true,
    });
  }

  /**
   * ID查找分案日期
   */
  public getTagApplyById (data) {
    return this.netService.send({
      server: strategicManage.dataStrategy.queryResponseEntityLogInfo,
      data,
    });
  }

}
